<include file="Public:header" />
<style>
    .checkoutform .panel{box-shadow:none;}
    #member_position .alert{margin:5px;}
    .lh34{line-height:34px;}
    .lrpd{padding-left:0;padding-right:0}
</style>
<div class="panel" style="padding-bottom:0">
    <header class="panel-heading custom-tab ">
        <ul class="nav nav-tabs" style="display: inline-block;">
            <li class="active">
                <a href="#home" data-toggle="tab" style="color:#696969!important;">增加员工</a>
            </li>
            <li>
                <a href="#about"  data-toggle="tab" style="color: #696969!important;">员工导入</a>
            </li>
        </ul>
        <a href="{:U('Employee/index')}" class="pull-right btn btn-success" style="color:#fff;border-radius:3px">员工管理</a>
    </header>
    <div class="panel-body" style="padding-top:0;">
        <div class="tab-content">
            <div class="tab-pane active" id="home">
                <form role="form" method="post" action="{:U('Employee/insert')}" class="checkoutform" style="background:#fff;" id="addemployee">
                    <section class="panel" style="margin-bottom:0">
                        <!--<header class="panel-heading custom-tab">-->
                        <!--<ul class="nav nav-tabs">-->
                        <!--<li class="active"> <a href="#home2" data-toggle="tab">基本信息</a> </li>-->
                        <!--</ul>-->
                        <!--</header>-->
                        <div class="panel-body" style="padding:0 80px;">
                            <div class="tab-content">
                                <div class="tab-pane active" id="home2">
                                    <input type='hidden' name='member_position_id[]' >
                                    <div   data-position="bottom" data-intro="填写基本信息" style="padding-top:30px;">
                                        <div class="row">
                                            <!--<header class="panel-heading" style="margin-bottom:15px"> 基本信息 </header>-->
                                            <div class="col-sm-6 lh34">
                                                <div class="col-sm-2  lrpd" style="width:50px!important;">姓名：</div>
                                                <div class="form-group text-input col-sm-4 col-lg-2 lrpd">
                                                    <input name="name" class="form-control" id="name" type="text" placeholder="姓名" datatype="*" nullmsg="姓名不能为空" errormsg="输入限制为文本" value="{$info.name}"/>
                                                </div>
                                            </div>
                                            <div class="col-sm-6" style="float:right;">
                                                <div class="col-sm-2 col-lg-2 lrpd" style="line-height: 42px;text-align:right;width:80px!important;padding-right:15px">性别：</div>
                                                <div class="icheck">
                                                    <div style="display:inline-block;">
                                                        <div class="radio square-red single-row" style="padding-left:0">
                                                            <input type="radio" value="1" checked name="sex">
                                                            <label>男</label>
                                                        </div>
                                                    </div>
                                                    <div style="display:inline-block;">
                                                        <div class="radio square-red single-row">
                                                            <input type="radio" value="0" name="sex">
                                                            <label>女</label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-sm-6 lh34">
                                                <div class="col-sm-2 col-lg-2 lrpd"  style="width:50px!important;">电话：</div>
                                                <div class="form-group text-input col-sm-6  col-lg-4 lrpd">
                                                    <input name="tel" class="form-control" datatype="m" placeholder="电话" id="tel" type="text" value="{$info.tel}"/>
                                                </div>
                                            </div>
                                            <div class="col-sm-6 lh34" style="float:left">
                                                <div class="col-sm-2 col-lg-2 lrpd" style="width:80px!important;text-align:right;padding-right:15px">邮箱：</div>
                                                <div class="form-group text-input col-sm-8 col-lg-5 lrpd">
                                                    <input class="form-control" datatype="/^\s*$/|e" id="Email" name="Email" placeholder="邮箱" value=""  autocomplete="off"  type="text">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-sm-6 lh34">
                                                <div class="col-sm-2 col-lg-2 lrpd" style="width:50px!important;">密码：</div>
                                                <div class="form-group text-input col-sm-6 col-lg-4 lrpd">
                                                    <input class="form-control" datatype="*6-18" id="password" name="password" placeholder="初始密码" value="123456"  type="text"  >
                                                </div>
                                            </div>
                                            <div class="col-sm-6 lh34" style="float:left">
                                                <div class="col-sm-2 col-lg-2 lrpd" style="width:80px!important;text-align:right;padding-right:15px">工号：</div>
                                                <div class="form-group text-input col-sm-8 col-lg-5 lrpd">
                                                    <input class="form-control" datatype="*" id="company_id" name="company_id" placeholder="工号" value=""  autocomplete="off"  type="text">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-sm-6 lh34">
                                                <div class="col-sm-2 col-lg-2 lrpd" style="width:50px!important;">状态：</div>
                                                <div class="form-group text-input col-sm-6 col-lg-4 lrpd">
                                                    <div class=" text-input">
                                                        <select class="form-control m-bot15" name="sta">
                                                            <option value="1" >正常</option>
                                                            <option value="0" >离职</option>
                                                            <option value="2" >请假</option>
                                                            <option value="3" >旷工</option>
                                                            <option value="4" >出差</option>
                                                            <option value="-1">禁用</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-sm-6 lh34" style="float:left">
                                                <div class="col-sm-4 col-lg-4 lrpd" style="width:80px!important;">入职时间：</div>
                                                <div class="form-group text-input col-sm-8 col-lg-5 lrpd">
                                                    <div class=" text-input">
                                                        <input placeholder="入职时间" style="cursor:pointer;background-color: #fff;" value=""  datatype="*" type="text" readonly class=" form-control datepicker input-none" name="reg_time" id="reg_time">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row" data-position="bottom" data-intro="为员工分配权限">
                                        <div class="form-group" style="margin-bottom:0">
                                            <div class="panel" style="margin-bottom: 0">
                                                <header class="panel-heading"> 请勾选一个角色 </header>
                                                <div class="panel-body">
                                                    <volist name="role_list" id="vo">
                                                        <?php $deep = $role_list[$key - 1]['cl']; if($deep != $vo['cl']){?>
                                                        <br>
                                                        <?php }?>
                                                        <div class="icheck" style="display:inline-block;">
                                                            <div class="square-red single-row">
                                                                <input <?php if(in_array($vo['id'], $member_role_userids)){?>checked<?php }?> type="radio" name="role_id[]" value="{$vo.id}" id="is_nav_2" />
                                                                <label>{$vo.title}</label>
                                                            </div>
                                                        </div>
                                                    </volist>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="panel row"  data-position="bottom" data-intro="选择部门" style="margin-bottom: 0;">
                                        <header class="panel-heading"> 选择部门/职位</header>
                                        <div class="panel-body pull-left">
                                            <html:dropdownselect class="employeeselect" listloaded="listloadedlistloaded" selected="" name="employee" style="height:auto; width:300px;" multi="0" action="{:U('Team/positionlist')}" title="选择部门" placeholder="点击选择部门"/>
                                            <style>
                                                .selectlist{margin:0; padding:0;}
                                                .selectlist ul{padding:0}
                                                .selectlist li{list-style-type:none; margin:0; padding:0;padding:5px; border-bottom:1px solid #eee; margin:0 8px;}
                                                .selectlist li:hover{background:#eee;}
                                            </style>
                                            <div id="reselectemployeelayout" style="top:0; display:none; left:0; bottom:0; right:0; position:fixed; z-index:99;"></div>
                                        </div>
                                        <div class="panel-body pull-left">
                                            <a href="{:U('Member_position/index')}" class="btn"  style="float:left;margin-right:5px;border:1px solid #ccc;color:#7a7676">部门管理</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="panel-body" style="text-align: center;">
                            <button class="btn btn-success btn-sm btnreset">保存</button>
                        </div>
                    </section>
                </form>
            </div>
            <div class="tab-pane " id="about" style="padding:30px 70px;"></div>
        </div>
    </div>
</div>
<include file="Public:script" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/bootstrap/css/font-awesome.min.css">
<link href="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/css/nanoscroller.css" rel="stylesheet">
<link href="__PUBLIC__/Intesys/AdminX/js/EmojiPicker/lib/css/emoji.css" rel="stylesheet">
<script>
    $('.checkoutform').Validform({
        ajaxPost:true,
        tiptype:function(msg, s, data){
            if(s.type == 1){
//                        $.ThinkBox.success('正在处理，请稍等……',{'delayClose':0,modal:false, 'close': '关闭',x:0,y:0,center:false,locate:['left','top'], show:['',0]});
            }
            if(s.type == 3){
                $.ThinkBox.error(msg,{'delayClose':500,modal:false, 'close': '关闭',x:0,y:0,center:false,locate:['left','top'], show:['',0]});
            }
        },
        datatype:{
            "text":function(gets,obj,curform,regxp){
                return true;
            },"image":function(gets,obj,curform,regxp){
                return true;
            }
        },
        callback:function(data){
            if(data.status == 0){
                $.ThinkBox.error(data.info,{'delayClose':200});
            }else{
                $.ThinkBox.success('操作成功',{'delayClose':1000,modal:false, 'close': '关闭',x:0,y:0,center:false,locate:['left','top'], show:['',0]});
                $('.checkoutform')[0].reset();
                $('.employeeselect.binded .itemspan').text('');
                $("#addemployee input[name='member_position_id[]']").remove();
                $('div.binded').text('');
//                $('.checkoutform input[name="__hash__"]').val();
//                $('div.employeeselect').html("<span style='cursor:pointer'>点击选择部门</span>");
            }
        }
    });
    function listloadedlistloaded(){
        $('.employeeselect').blur(function(){
            $("#addemployee input[name='member_position_id']").remove();
            $('.employeeselect.binded .itemspan').each(function(){
                $('#addemployee').append("<input type='hidden' name='member_position_id' value='"+$(this).children("input:eq(1)").attr('value')+"'>");
            });
        });
    }
    $('#reg_time').datepicker({ dateFormat: 'yy-mm-dd' });
    $.post("{:U('Member_group/expage',['symbol'=>'1'])}",function(data){
        $('#about').html(data.tbody);
    },'json');
</script>
</body></html>
